<%@ page import="com.psl.model.userlogin" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    userlogin userinfo = (userlogin) session.getAttribute("user");
    if (userinfo == null) {
        response.sendRedirect("/login.do");
    }%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="/assets/css/text.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/main.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/content.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript">
    </script>
    <style>
        #title {
            width: 92%;
            border: 0px;
            margin-bottom: 10px;
        }

        #title td {
            text-align: center;
            height: 20px;
            line-height: 150%
        }

        #title div {
            background-image: url(/assets/img/dot_02.gif);
            background-position: left top;
            background-repeat: no-repeat;
            margin: 0 auto;
            padding-left: 20px;
            text-align: left;
            width: 10%;
            font-size: 15px;
            font-weight: bold;
            color: #CC0000;
            letter-spacing: 2px;
        }
    </style>
</head>
<body>

<table cellspacing="0" cellpadding="0" id="title" align="center">
    <tbody>
    <tr>
        <td nowrap="nowrap">
            <div> 产品清单</div>
        </td>
    </tr>
    </tbody>
</table>

<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" class="datalist">
    <tbody>
    <tr>
        <th colspan="1">选择</th>
        <th colspan="1">产品编号</th>
        <th colspan="1">产品名称</th>
        <th colspan="1">规格</th>
        <th colspan="1">库存</th>
        <th colspan="3">操作 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
        <th colspan="1"><a href="">历史记录</a> </th>
    </tr>
    <tr>
        <form action="/gethname4.do" method="post">
            <td align="center" colspan="1"></td>
            <td align="center" colspan="1"></td>
            <td align="center" colspan="1"><input name="h_name" type="text" value=""></td>
            <td align="center" colspan="1"><input name="h_size" type="text" value=""></td>
            <td align="center" colspan="5"><input type="submit" value="查询"/></td>
        </form>
    </tr>
    <c:if test="${not empty query}">
        <c:forEach items="${query}" var="q" varStatus="status">
            <script>
                function add${status.count}() {
                    document.getElementById("nox").innerHTML = document.form${status.count}.no.value;
                    document.getElementById("p_no").value = document.form${status.count}.no.value;
                    document.getElementById("namex").innerHTML = document.form${status.count}.name.value;
                    document.getElementById("p_name").value = document.form${status.count}.name.value;
                    document.getElementById("sizex").innerHTML = document.form${status.count}.size.value;
                    document.getElementById("p_size").value = document.form${status.count}.size.value;
                }
            </script>
            <form name="form${status.count}">
                <tr class="change">
                    <td align="center" colspan="1"><input type="button" value="选择" onclick="add${status.count}()"/></td>
                    <td align="center" colspan="1"><input type="hidden" id="no${status.count}" name="no"
                                                          value="${q.h_no}"/> ${q.h_no}</td>
                    <td align="center" colspan="1"><input type="hidden" id="name${status.count}" name="name"
                                                          value="${q.h_name}"/>${q.h_name}</td>
                    <td align="center" colspan="1"><input type="hidden" id="size${status.count}" name="size"
                                                          value="${q.h_size}"/>${q.h_size}</td>
                    <td align="center" colspan="1"></td>
                    <td align="center" colspan="4"></td>
                </tr>
            </form>
        </c:forEach>
    </c:if>
    <tr>
        <th align="center">保存</th>
        <th height="25" align="center">产品编号</th>
        <th height="25" align="center">产品名称</th>
        <th align="center">规格</th>
        <th align="center">商标</th>
        <th align="center">压力</th>
        <th align="center">单重</th>
        <th align="center">单价</th>
        <th align="center" colspan="2">ORDER Q.TY</th>
    </tr>
    <form name="formn" action="/saveInvoice.do" method="post">
        <tr>
            <td align="center"><input type="submit" value="保存"/></td>
            <td height="25" align="center"><input type="hidden" value="" id="p_no" name="p_no"/>
                <div id="nox"></div>
            </td>
            <td height="25" align="center"><input type="hidden" value="" id="p_name" name="p_name"/>
                <div id="namex"></div>
            </td>
            <td align="center"><input type="hidden" value="" id="p_size" name="p_size"/>
                <div id="sizex"></div>
            </td>
            <td align="center">
                <select name="p_r" class="nobtn">
                    <option value="PSL">PSL</option>
                    <option value="TVT">TVT</option>
                    <option value="SK">SSK</option>
                    <option value="SI">SI</option>
                    <option value="other">other</option>
                </select>
            </td>
            <td align="center">
                <select name="p_n" class="nobtn">
                    <option value="10">10</option>
                    <option value="16">16</option>
                    <option value="25">25</option>
                </select>
            </td>
            <td align="center"><input type="text" value="" name="p_uw"/>
            </td>
            <td align="center"><input type="text" value="" name="p_up"/>
            </td>
            <td align="center" colspan="1">
                <input type="number" name="p_zx" value="" min="0"/>
            </td>
        </tr>
    </form>
    <c:forEach items="${jist}" var="l">
        <tr>
            <td align="center"><a href=""><img src="/assets/img/icodelete.gif"></a></td>
            <td align="center">${l.p_no}</td>
            <td align="center">${l.p_name}</td>
            <td align="center">${l.p_size}</td>
            <td align="center">${l.p_r}</td>
            <td align="center">${l.p_n}</td>
            <td align="center">${l.p_uw}</td>
            <td align="center">${l.p_up}</td>
            <td align="center">${l.p_zx}</td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="10"></td>
    </tr>
    <tr align="center">
        <td colspan="1"><input type="button" name="button" value="制作形式发票" onclick="submit_p()"></td>
        <td colspan="1"><input type="button" name="button" value="制作商业发票" onclick="submit_c()"></td>
        <td colspan="1"><input type="button" name="button" value="制作装箱单" onclick="submit_pa()"></td>
        <td colspan="1"><input type="button" name="button" value="全部制作完毕后点我" onclick="finishit()"></td>
        <td colspan="6"></td>
    </tr>
    </tbody>
</table>
<script>
    function submit_p() {
        window.location.href="/CommericalInvoice.do";
    }
    function submit_c() {
        window.location.href="/PackingList.do";
    }
    function submit_pa() {
        window.location.href="/ProformaInvoice.do";
    }
</script>
</body>
</html>